package com.edu.ahm.lambda;

public class Lambda1 {
    /**
     * 静态内部类
     */
    static class Like2 implements ILike{

        @Override
        public void like() {
            System.out.println( " i like 2");
        }
    }

    public static void main(String[] args) {

        /**
         * 局部内部类
         */
        class Like3 implements ILike{
            @Override
            public void like() {
                System.out.println("i like 3");
            }
        }



        // 1
        ILike iLike = new Like1();
        iLike.like();
        // 2
        iLike = new Like2();
        iLike.like();
       // 3
        iLike = new Like3();
        iLike.like();
        /**
         * 匿名内部类
         */
        new ILike(){

            @Override
            public void like() {
                System.out.println(" i like 4");
            }
        }.like();
        // 5
        iLike = ()->{
            System.out.println(" i like  5");
        };
        iLike.like();
        //

    }
}

class Like1  implements ILike{
    @Override
    public void like() {
        System.out.println(" i like 1");
    }
}